package com.tpc.control.jpa;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Division entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "division", catalog = "production_control")
public class Division implements java.io.Serializable {

	// Fields

	private String division;
	private String divisionName;
	private Set<SaleData> saleDatas = new HashSet<SaleData>(0);

	// Constructors

	/** default constructor */
	public Division() {
	}

	/** minimal constructor */
	public Division(String division, String divisionName) {
		this.division = division;
		this.divisionName = divisionName;
	}

	/** full constructor */
	public Division(String division, String divisionName,
			Set<SaleData> saleDatas) {
		this.division = division;
		this.divisionName = divisionName;
		this.saleDatas = saleDatas;
	}

	// Property accessors
	@Id
	@Column(name = "division", unique = true, nullable = false, length = 2)
	public String getDivision() {
		return this.division;
	}

	public void setDivision(String division) {
		this.division = division;
	}

	@Column(name = "division_name", nullable = false, length = 40)
	public String getDivisionName() {
		return this.divisionName;
	}

	public void setDivisionName(String divisionName) {
		this.divisionName = divisionName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "division")
	public Set<SaleData> getSaleDatas() {
		return this.saleDatas;
	}

	public void setSaleDatas(Set<SaleData> saleDatas) {
		this.saleDatas = saleDatas;
	}

}